package first;

import java.util.Calendar;
import java.util.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class FirstSpring {
	
	public static void main(String[] args) {
		String config="applicationContext.xml";	

		/**
		 * ApplicationContext是接口
		 * ClassPathXmlApplicationContext是一个实现类
		 * 该类会依据类路径去查找spring配置文件,
		 * 然后启动容器
		 * 
		 */
		
		ApplicationContext ac = 
				new ClassPathXmlApplicationContext(config);
	
//		System.out.println(ac);
		//Student.class 是方法区中的对象.
		Student stu1 = ac.getBean("stu1",Student.class);
		
		System.out.println(stu1);
		
		Date date = ac.getBean("date1",Date.class);
		
		System.out.println(date);
		
		Calendar cal = ac.getBean("cal1",Calendar.class);
		
		System.out.println(cal);
		
		
		Date time1 = ac.getBean("time1",Date.class);
		System.out.println(time1);
		
		
	}

}



	









